package com.team.ai.controller;

import com.team.ai.entity.ResultEntity;
import com.team.ai.service.AiVideoService;
import com.team.ai.service.VideoService;
import jakarta.annotation.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;

@CrossOrigin//跨域
@RestController//遵循RestFul
@RequestMapping("v2/AiVideo/")
public class AiVideoController {
    @Resource
    AiVideoService aivideoService;

    @PostMapping("insert")
    private String insert(
            @RequestParam(value = "video",defaultValue = "-1") String video,
            @RequestParam(value = "title",defaultValue = "-1") String title
    ){
        return aivideoService.insert(video, title);

    }

    /**
     * 删
     * @param id
     * @return
     */
    @DeleteMapping("delete")
    private String delete(
            @RequestParam(value = "id",defaultValue = "-1") int id

    ){
        return aivideoService.delete(id);
    }

    /**
     * 改
     */
    @PostMapping("update")
    private String update(
            @RequestParam(value = "video",defaultValue = "-1") String video,
            @RequestParam(value = "title",defaultValue = "-1") String title,
            @RequestParam(value = "id",defaultValue = "-1") int id
    ){

        return aivideoService.update(video,title, id);

    }


    /**
     * 查
     * @return
     */
    @GetMapping("selectList")
    private String selectList(

    ){
        return aivideoService.selectList();

    }
    @GetMapping("selectDetail")
    private String selectDetail(
            @RequestParam(value = "id",defaultValue = "-1") int id

    ){
        return aivideoService.selectDetail(id);

    }

}
